package streamAPI.operators;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import streamAPI.source.MyNoParallelSource;

/**
 * @author yue.cao
 * @since 09-28-2020
 */
public class DemoWithUnion {

	public static void main(String[] args) throws Exception {
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		DataStreamSource<Long> stream1 = env.addSource(new MyNoParallelSource());
		DataStreamSource<Long> stream2 = env.addSource(new MyNoParallelSource());
		DataStreamSource<Long> stream3 = env.addSource(new MyNoParallelSource());
		DataStream<Long> union = stream1.union(stream2).union(stream3);
		union.print().setParallelism(1);
		env.execute();

	}
}
